Add horizontal and vertical expand flags, compute_expand() to GtkWidget
authorHavoc Pennington <hp@pobox.com>
Mon, 6 Sep 2010 16:26:32 +0000 (12:26 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 13 Oct 2010 14:40:07 +0000 (10:40 -0400)
commit031856eb3321ac8043c80ce98ee6c1d051b48d6e
treebfdee0e0e5d62944074fc050dbef763a7cb26f02
parent7d5a85c3ad6ba6aa891edcafd8cdb3d397184002
Add horizontal and vertical expand flags, compute_expand() to GtkWidget

GtkWidget now has flags for horizontal and vertical expand, and
a compute_expand() method. compute_expand() is used by containers
to set a default expand flag. (If a widget has expand set explicitly,
it always overrides the results of compute_expand.)

GtkContainer has a default implementation of compute_expand which
simply walks over all child widgets and sets expand=TRUE
if any child is expanding.

The overall effect is that you only have to set expand on
leaf nodes in the widget tree, while previously you had to
set expand all the way up the tree as you packed every
container. Also, now containers need not have their own child
properties for expand.

For old containers which do have "expand" child properties,
they should override compute_expand and include the child
properties in whether the container is expand=TRUE.
Also, the old container should use
"child_prop_expand || gtk_widget_compute_expand()" everywhere
it previously used simply "child_prop_expand"

https://bugzilla.gnome.org/show_bug.cgi?id=628902
gtk/gtkcontainer.c
gtk/gtkwidget.c
gtk/gtkwidget.h